﻿/*----------------------------------------------------------------
// 文件名：DaSampleKept.cs
// 功能描述：类SampleKept的数据访问层
//
// 
// 创建时间：2009-02-27
//
// 修改标识： 
// 修改描述： 
//----------------------------------------------------------------*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Text;
using System.Xml;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using EQT.Model;

namespace EQT.Dal
{
    public partial class DaSampleKept
    {

        public DataSet GetSampleKeptRecords(string condition, int PageSize, int PageIndex, out int TotalCount)
        {

            string strGetEmploreeRecords = "select * from Sample_Kept ";

            if (!string.IsNullOrEmpty(condition))
            {
                strGetEmploreeRecords = strGetEmploreeRecords + condition;
            }

            try
            {
                return DaCommon.GetPaginationData(strGetEmploreeRecords, PageSize, PageIndex, " Sam_Kep_ID desc", out TotalCount);

            }
            catch (DbException ex)
            {
                HandleDbException(ex);
            }
            TotalCount = 0;
            return new DataSet();
        }

        /// <summary>
        /// 注销样品登记。
        /// </summary>
        /// <param name="strKey"></param>
        /// <returns></returns>
        public int CancelRegister(string strKey)
        {
            string SQL = "update Sample_Kept set Sample_Status='注销' where Sam_Kep_ID='" + strKey + "'";

            try
            {
                return db.ExecuteNonQuery(CommandType.Text, SQL);
            }
            catch (DbException ex)
            {
                HandleDbException(ex);
            }
            return 0;
        }
    }
}

